-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
lib/bundler/rubygems_integration.rb
Outdated
@@ -514,6 +514,15 @@ def replace_entrypoints(specs) | |||
h | |||
end | |||
|
|||
Gem::Specification.send(:default_stubs, "*.gemspec").each do |stub| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using send
here, because default_stubs
is private. We should probably make it public in rubygems
, or make a separate method public that calls default_stubs
with the "*.gemspec" pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense. I applied it: rubygems/rubygems#2675
I think this may have already been patched by @hsbt in ruby-src IIRC. |
This is the issue i'm talking about https://bugs.ruby-lang.org/issues/15469 |
They are similar issues, but different I think. The issue you mention is about versions of default gems included in the Gemfile being ignored, and activating the default version instead. This was fixed by @hsbt in both ruby-core and #6941. Ruby core ticket: https://bugs.ruby-lang.org/issues/15469. This one is about default gems not being activated at all unless they are included in the Gemfile. Ruby core ticket: https://bugs.ruby-lang.org/issues/15503. |
I also agree with this issue was different from https://bugs.ruby-lang.org/issues/15469. @deivid-rodriguez I'll check this later. Thanks. |
lib/bundler/rubygems_integration.rb
Outdated
@@ -514,6 +514,15 @@ def replace_entrypoints(specs) | |||
h | |||
end | |||
|
|||
Gem::Specification.send(:default_stubs, "*.gemspec").each do |stub| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense. I applied it: rubygems/rubygems#2675
136a12b
to
c82cd39
Compare
@hsbt I added a compatibility layer so that the new public method gets used if available, and otherwise we use |
c82cd39
to
a08339f
Compare
Even when they are not explicitly specified in the Gemfile.
a08339f
to
1239c8c
Compare
I removed one unnecessary change in specs from this PR, and also rebased it! 👍 |
This has waited for a while now, and we're separately discussing other minor things about default gem handling when they don't even work at the moment... 😅. So merging away! @bundlerbot r+ |
6963: Allow to `bundle exec` default gems r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that since `irb` and others were moved to default gems, users cannot directly use them in a bundler context, unless they add it to their gemfiles. In my opinion, this completely defeats the purpose of default gems, and makes bundler degrade the user experience instead of making it better. ### What was your diagnosis of the problem? My diagnosis was that when bundler replaces the set of gems known to rubygems, it restricts the world to what's in the Gemfile (or resolved from it), and that doesn't include default gems. ### What is your fix for the problem, implemented in this PR? My fix is to also include the set of default gems, unless they are already included in the gemfile dependencies. ### Why did you choose this fix out of the possible options? I chose this fix because it's reasonably simple and I think it shouldn't affect how other parts of bundler function. Fixes #6929. Fixes https://bugs.ruby-lang.org/issues/15503. Co-authored-by: David Rodríguez <[email protected]>
Build succeeded |
6963: Allow to `bundle exec` default gems r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that since `irb` and others were moved to default gems, users cannot directly use them in a bundler context, unless they add it to their gemfiles. In my opinion, this completely defeats the purpose of default gems, and makes bundler degrade the user experience instead of making it better. ### What was your diagnosis of the problem? My diagnosis was that when bundler replaces the set of gems known to rubygems, it restricts the world to what's in the Gemfile (or resolved from it), and that doesn't include default gems. ### What is your fix for the problem, implemented in this PR? My fix is to also include the set of default gems, unless they are already included in the gemfile dependencies. ### Why did you choose this fix out of the possible options? I chose this fix because it's reasonably simple and I think it shouldn't affect how other parts of bundler function. Fixes #6929. Fixes https://bugs.ruby-lang.org/issues/15503. Co-authored-by: David Rodríguez <[email protected]> (cherry picked from commit 3b6c6e3)
7043: Remove old rubygems compatibility code r=bronzdoc a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that I was unsure where I needed to add the compatibility layer to #6963, and it took me a bit to scan through the compatibility file and figure it out. ### What was your diagnosis of the problem? My diagnosis was that all this compatibility code is unused but makes this file harder to understand and scan through. ### What is your fix for the problem, implemented in this PR? My fix is to remove the code. ### Why did you choose this fix out of the possible options? I chose this fix because we can do it, I think. Co-authored-by: David Rodríguez <[email protected]>
* 2-0-stable: (89 commits) fix changelog 2.0.2 typos add v2.0.2 changelog bump version to 2.0.2 Merge #7199 fix bug where bundler v3 is running a test for bundflet 2 Merge #6798 add bors configuation port GemHelper from master Merge #7080 Merge #7089 Merge #7068 Merge #7036 Merge #7067 change Bundler 3 specs in travis to use RubyGems 3.0.3 bump RubyGems v3 to the latest version on Travis Merge #6963 Merge #7078 Merge pull request #7061 from bundler/fix_circular_requires Merge #6864 remove linting step in travis (it will still run in each build) ...
Ever since upgrading to Ruby 2.6, I've experienced the following crash when running `bin/rails console`: ``` $ bin/rails c warning package.json: No license field warning No license field Running via Spring preloader in process 12917 Traceback (most recent call last): 28: from -e:1:in `<main>' 27: from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 26: from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 25: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 24: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 23: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load' 22: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 21: from /home/jeremy/gitting/worldcubeassociation.org/WcaOnRails/bin/rails:11:in `<top (required)>' 20: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 19: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 18: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 17: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 16: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>' 15: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:44:in `invoke' 14: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:70:in `find_by_namespace' 13: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:79:in `lookup' 12: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:79:in `each' 11: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:80:in `block in lookup' 10: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:80:in `each' 9: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:84:in `block (2 levels) in lookup' 8: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 7: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 6: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 5: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 4: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/console/console_command.rb:3:in `<top (required)>' 3: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 2: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 1: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require': cannot load such file -- irb (LoadError) ``` Some Googling let me on the following journey: - https://www.reddit.com/r/rails/comments/akhmae/ruby_26_breaks_rails_console/ -> - Shopify/bootsnap#223 -> - rubygems/bundler#6929 (comment) So, this appears to be due to a bundler change, and one workaround is to explicitly add `irb` to your Gemfile. It seems like this may be fixed in a future version of bundler: rubygems/bundler#6963.
Ever since upgrading to Ruby 2.6 (see thewca#3873), I've experienced the following crash when running `bin/rails console`: ``` $ bin/rails c warning package.json: No license field warning No license field Running via Spring preloader in process 12917 Traceback (most recent call last): 28: from -e:1:in `<main>' 27: from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 26: from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 25: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 24: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 23: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load' 22: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 21: from /home/jeremy/gitting/worldcubeassociation.org/WcaOnRails/bin/rails:11:in `<top (required)>' 20: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 19: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 18: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 17: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 16: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>' 15: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:44:in `invoke' 14: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:70:in `find_by_namespace' 13: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:79:in `lookup' 12: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:79:in `each' 11: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:80:in `block in lookup' 10: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:80:in `each' 9: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:84:in `block (2 levels) in lookup' 8: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 7: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 6: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 5: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 4: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/console/console_command.rb:3:in `<top (required)>' 3: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 2: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 1: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require': cannot load such file -- irb (LoadError) ``` At first I thought this was a quirk of my local environment, but some Googling let me on the following journey: - https://www.reddit.com/r/rails/comments/akhmae/ruby_26_breaks_rails_console/ -> - Shopify/bootsnap#223 -> - rubygems/bundler#6929 (comment) So, this appears to be due to a bundler change, and one workaround is to explicitly add `irb` to your Gemfile. It seems like this may be fixed in a future version of bundler: rubygems/bundler#6963.
Ever since upgrading to Ruby 2.6 (see #3873), I've experienced the following crash when running `bin/rails console`: ``` $ bin/rails c warning package.json: No license field warning No license field Running via Spring preloader in process 12917 Traceback (most recent call last): 28: from -e:1:in `<main>' 27: from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 26: from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 25: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 24: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 23: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load' 22: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load' 21: from /home/jeremy/gitting/worldcubeassociation.org/WcaOnRails/bin/rails:11:in `<top (required)>' 20: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 19: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 18: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 17: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 16: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>' 15: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:44:in `invoke' 14: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:70:in `find_by_namespace' 13: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:79:in `lookup' 12: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:79:in `each' 11: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:80:in `block in lookup' 10: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:80:in `each' 9: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command/behavior.rb:84:in `block (2 levels) in lookup' 8: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 7: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 6: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' 5: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 4: from /home/jeremy/.gem/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/console/console_command.rb:3:in `<top (required)>' 3: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require' 2: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency' 1: from /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require' /home/jeremy/.gem/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require': cannot load such file -- irb (LoadError) ``` At first I thought this was a quirk of my local environment, but some Googling let me on the following journey: - https://www.reddit.com/r/rails/comments/akhmae/ruby_26_breaks_rails_console/ -> - Shopify/bootsnap#223 -> - rubygems/bundler#6929 (comment) So, this appears to be due to a bundler change, and one workaround is to explicitly add `irb` to your Gemfile. It seems like this may be fixed in a future version of bundler: rubygems/bundler#6963.
## 2.0.2 (2019-05-13) Changes: - Fixes for Bundler integration with ruby-src ([#6941](rubygems/bundler#6941), [#6973](rubygems/bundler#6973), [#6977](rubygems/bundler#6977), [#6315](rubygems/bundler#6315), [#7061](rubygems/bundler#7061)) - Use `__dir__` instead of `__FILE__` when generating a gem with `bundle gem` ([#6503](rubygems/bundler#6503)) - Use `https` on externals links in the Bundler gemspec ([#6721](rubygems/bundler#6721)) - Removed duplicate gem names from the suggested `did you mean` list for gem typos ([#6739](rubygems/bundler#6739)) - Removed Ruby 1.x compatibility code ([#6764](rubygems/bundler#6764), [#6806](rubygems/bundler#6806)) - Fixed an issue where `bundle remove` would crash with certain Gemfiles ([#6768](rubygems/bundler#6769)) - Fixed indentation in the Bundler executable template ([#6773](rubygems/bundler#6773)) - Fixed an issue where plugins could register for the same Bundler hook multiple times ([#6775](rubygems/bundler#6775)) - Changed the "multiple sources" message in `bundle install` to be a warning instead of an error ([#6790](rubygems/bundler#6790)) - Fixed a bug where path gems would break when using `only_update_to_newer_versions` ([#6774](rubygems/bundler#6774)) - Fixed a bug where installing plugins with the `--delpoyment` setting would fail ([#6805](rubygems/bundler#6805)) - Fixed an issue where `bundle update` couldn't update & install a gem when `no_install` was set (a `bundle package` config) ([#7078](rubygems/bundler#7078)) - Fixed an issue where users could not run `bundle exec` on default gems ([#6963](rubygems/bundler#6963)) - Updated vendor libraries to their latest version ([#7076](rubygems/bundler#7067), [#7068](rubygems/bundler#7068)) - Fixed an issue where the `github` source was not using `https` by default that we mentioned in the 2.0 release ([#7182](rubygems/bundler#7182)) - Fixed an issue where `rake release` was not outputting the message to users asking for a 2fa token ([#7199](rubygems/bundler#7199)) Documentation: - Fix incorrect documented `BUNDLE_PATH_RELATIVE_TO_CWD` env var ([#6751](rubygems/bundler#6751)) - Update URLs in Bundler's documentation to use `https` ([#6935](rubygems/bundler#6935)) ## 2.0.1 (2019-01-04) Changes: - Relaxed RubyGems requirement to `>= 2.5.0` ([#6867](rubygems/bundler#6867)) ## 2.0.0 (2019-01-03) No new changes ## 2.0.0.pre.3 (2018-12-30) Breaking Changes: - Bundler 2 now requires RubyGems 3.0.0 at minimum Changes: - Ruby 2.6 compatibility fixes (@segiddins) - Import changes from Bundler 1.17.3 release Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler` ## 2.0.0.pre.2 (2018-11-27) Breaking Changes: - `:github` source in the Gemfile now defaults to using HTTPS Changes - Add compatibility for Bundler merge into ruby-src Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler` ## 2.0.0.pre.1 (2018-11-09) Breaking Changes: - Dropped support for versions of Ruby < 2.3 - Dropped support for version of RubyGems < 2.5 - Moved error messages from STDOUT to STDERR Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`
Since bundler 2.0.2, default gems (including irb) is loaded by default. You don't have to specify 'irb' in Gemfile. see rubygems/bundler#6963
What was the end-user problem that led to this PR?
The problem was that since
irb
and others were moved to default gems, users cannot directly use them in a bundler context, unless they add it to their gemfiles. In my opinion, this completely defeats the purpose of default gems, and makes bundler degrade the user experience instead of making it better.What was your diagnosis of the problem?
My diagnosis was that when bundler replaces the set of gems known to rubygems, it restricts the world to what's in the Gemfile (or resolved from it), and that doesn't include default gems.
What is your fix for the problem, implemented in this PR?
My fix is to also include the set of default gems, unless they are already included in the gemfile dependencies.
Why did you choose this fix out of the possible options?
I chose this fix because it's reasonably simple and I think it shouldn't affect how other parts of bundler function.
Fixes #6929.
Fixes https://bugs.ruby-lang.org/issues/15503.